home *** CD-ROM | disk | FTP | other *** search
- '**************************************************************************
- '* Houdini Windows Setup Script
- '**************************************************************************
-
- '$UNDEF DEBUG ''Define for script development/debugging
-
- '$INCLUDE 'setupapi.inc'
- '$INCLUDE 'msdetect.inc'
-
- ''Dialog ID's
- CONST WELCOME = 100
- CONST ASKQUIT = 200
- CONST DESTPATH = 300
- CONST EXITFAILURE = 400
- CONST EXITQUIT = 600
- CONST EXITSUCCESS = 700
- CONST OPTIONS = 800
- CONST APPHELP = 900
- CONST CUSTINST = 6200
- CONST TOOBIG = 6300
- CONST BADPATH = 6400
-
- ''following were taken from windows.h. &H means they're hex
- CONST WS_VISIBLE =&H10000000
- CONST WS_BORDER =&H00800000
- CONST WS_CLIPCHILDREN =&H02000000
- CONST GWL_STYLE =-16
- CONST SW_SHOWMAXIMIZED =3
-
- '** Bitmap ID
- CONST LOGO = 1
-
- '** Install Sets (correspond to check-boxes in install dialog)
-
- CONST kInstallWinClip = 1
- CONST kInstallDOSClip = 2
- CONST kInstallMacShare = 3
- CONST kInstallCDROM = 4
-
- '** Flags for StripFileAndAdd
-
- CONST kNoBackupFlag = 1
-
- '** Destination Directory
-
- GLOBAL gDest$ '' Destination directory
- GLOBAL gAltCfgDir$ '' Path to alternate configuration
- GLOBAL gAutoExec$ '' Path to AutoExec.bat file
- GLOBAL gConfigSys$ '' Path to Config.sys file
- GLOBAL gSysDrive$ '' Path of system disk
- GLOBAL gSysIni$ '' Path to System.Ini file
-
- '** Dialog list symbol names
-
- GLOBAL gCheckStates$
- GLOBAL gDriveText$
-
- DECLARE SUB Install
- DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
-
- DECLARE FUNCTION ShowWindow LIB "user.exe" (hWnd%,iShow%) AS INTEGER
- DECLARE FUNCTION SetWindowLong LIB "user.exe" (hWnd%, offset%, style&) AS LONG
- DECLARE FUNCTION StripFileAndAdd LIB "mscuistf.dll" (szPath$, szStrip$, szAdd$, flags%) AS INTEGER
- DECLARE FUNCTION QuitAppByWindowClass LIB "mscuistf.dll" (szWinClass$) AS INTEGER
-
- INIT:
- CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
- HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
-
- '** Expand the main setup window to full-screen size
-
- hWnd%=HwndFrame()
- m&=SetWindowLong(hWnd%, GWL_STYLE,WS_VISIBLE+WS_BORDER+WS_CLIPCHILDREN)
- n%=ShowWindow(hWnd%, SW_SHOWMAXIMIZED)
-
- '** Set our logo bitmap and window title
-
- SetBitmap CUIDLL$, LOGO
- SetTitle "DOS Compatibility Installer"
-
- '** Read the .inf file
-
- szInf$ = GetSymbolValue("STF_SRCINFPATH")
- IF szInf$ = "" THEN
- szInf$ = GetSymbolValue("STF_CWDDIR") + "appleDOS.INF"
- END IF
- ReadInfFile szInf$
-
- '** Setup some default paths
-
- gSysDrive$ = MID$(GetWindowsDir, 1, 1)
- gDest$ = gSysDrive$ + ":\Apple"
- gAltCfgDir$ = gSysDrive$ + ":\ALT_CFGS"
- gAutoExec$ = gSysDrive$ + ":\AutoExec.bat"
- gConfigSys$ = gSysDrive$ + ":\Config.sys"
- gSysIni$ = MakePath(GetWindowsDir, "System.ini")
-
- '** CustInst list symbols
-
- gCheckStates$ = "CheckItemsState"
- gDriveText$ = "DriveStatusText"
- FOR i% = 1 TO 4
- AddListItem gCheckStates$, "ON"
- NEXT i%
- FOR i% = 1 TO 7
- AddListItem gDriveText$, ""
- NEXT i%
-
- '** Put up the welcome dialog
-
- WELCOME:
- sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
- IF sz$ = "CONTINUE" THEN
- UIPop 1
- ELSE
- GOSUB ASKQUIT
- GOTO WELCOME
- END IF
-
- CUSTINST:
-
- '** Setup the destination path
-
- IF LEN(gDest$) > 23 THEN
- ReplaceListItem gDriveText$, 7, MID$(gDest$, 1, 23)+"..."
- ELSE
- ReplaceListItem gDriveText$, 7, gDest$
- END IF
-
- '** Put up our custom install screen
-
- sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
-
- '** Respond to custom install
-
- IF sz$ = "CONTINUE" THEN
- UIPop 1
- GOTO DoInstall
- ELSEIF sz$ = "PATH" THEN
- GOTO GETPATH
- ELSEIF sz$ = "CHK1" THEN
- GOTO CUSTINST
- ELSEIF sz$ = "CHK2" THEN
- GOTO CUSTINST
- ELSEIF sz$ = "CHK3" THEN
- GOTO CUSTINST
- ELSEIF sz$ = "CHK4" THEN
- GOTO CUSTINST
- ELSEIF sz$ = "REACTIVATE" THEN
- GOTO CUSTINST
- ELSE
- GOSUB ASKQUIT
- GOTO CUSTINST
- END IF
-
- GETPATH:
- SetSymbolValue "EditTextIn", gDest$
- SetSymbolValue "EditFocus", "END"
- GETPATHL1:
- sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
- gDest$ = GetSymbolValue("EditTextOut")
-
- IF sz$ = "CONTINUE" THEN
- IF IsDirWritable(gDest$) = 0 THEN
- GOSUB BADPATH
- GOTO GETPATHL1
- END IF
- UIPop 1
- GOTO CUSTINST
- ELSEIF sz$ = "REACTIVATE" THEN
- GOTO GETPATHL1
- ELSEIF sz$ = "BACK" THEN
- UIPop 1
- GOTO WELCOME
- ELSE
- GOSUB ASKQUIT
- GOTO GETPATH
- END IF
-
- DoInstall:
-
- '** Install the software
-
- Install
-
- '** Cleanup, handling errors
-
- QUIT:
- ON ERROR GOTO ERRQUIT
-
- IF ERR = 0 THEN
- dlg% = EXITSUCCESS
- ELSEIF ERR = STFQUIT THEN
- dlg% = EXITQUIT
- ELSE
- dlg% = EXITFAILURE
- END IF
- QUITL1:
- sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO QUITL1
- END IF
- UIPop 1
-
- END
-
- ERRQUIT:
- i% = DoMsgBox("Setup sources were corrupted, call 555-1212!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
- END
-
-
-
- BADPATH:
- sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO BADPATH
- END IF
- UIPop 1
- RETURN
-
-
-
- ASKQUIT:
- sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
-
- IF sz$ = "EXIT" THEN
- UIPopAll
- ERROR STFQUIT
- ELSEIF sz$ = "REACTIVATE" THEN
- GOTO ASKQUIT
- ELSE
- UIPop 1
- END IF
- RETURN
-
-
-
- '**
- '** Purpose:
- '** Builds the copy list and performs all installation operations.
- '** Arguments:
- '** none.
- '** Returns:
- '** none.
- '*************************************************************************
- SUB Install STATIC
- autoExecFlags% = 0
- configSysFlags% = 0
- needTmp% = 0
-
- '** Create the destination directory
-
- srcDir$ = GetSymbolValue("STF_SRCDIR")
- CreateDir gDest$, cmoVital
- CreateDir gAltCfgDir$, cmoVital
-
- '** Send a quit message to WinClip
-
- IF QuitAppByWindowClass("ClipSrvrWClass") <> 0 THEN
- '** Couldn't find the window: so... Do you care?
- END IF
-
- '** Copy the files
-
- AddSectionFilesToCopyList "APPLEDIR", srcDir$, gDest$
- AddSectionFilesToCopyList "ALTCFGDIR", srcDir$, gAltCfgDir$
- AddSectionFilesToCopyList "SYSTEMDIR", srcDir$, GetWindowsSysDir
- CopyFilesInCopyList
-
- '** Add WinClip to the startup group
-
- IF GetListItem(gCheckStates$, kInstallWinClip) = "ON" THEN
- needTmp% = 1
- CreateProgmanGroup "Startup", "", cmoNone
- CreateProgmanItem "Startup", "Clipboard Converter", MakePath(gDest$, "WinClip.exe"), "", cmoOverwrite
-
- IF StripFileAndAdd(gAutoExec$, "ApplePC", "LH " + MakePath(gDest$, "ApplePC"), autoExecFlags%) = 0 THEN
- autoExecFlags% = kNoBackupFlag
- END IF
- END IF
-
- '** Add MacShare to AutoExec.bat
-
- IF GetListItem(gCheckStates$, kInstallMacShare) = "ON" THEN
- IF StripFileAndAdd(gAutoExec$, "MacShare", "LH " + MakePath(gDest$, "MacShare"), autoExecFlags%) = 0 THEN
- autoExecFlags% = kNoBackupFlag
- END IF
- END IF
-
- '** Add CDROM to AutoExec.bat & Config.sys
-
- IF GetListItem(gCheckStates$, kInstallCDROM) = "ON" THEN
- IF StripFileAndAdd(gAutoExec$, "MSCDEX", "LH " + gSysDrive$ + ":\DOS\MSCDEX /D:CDDRVR /L:E", autoExecFlags%) = 0 THEN
- autoExecFlags% = kNoBackupFlag
- END IF
- IF StripFileAndAdd(gConfigSys$, "CDROM", "DEVICE=" + MakePath(gDest$, "CDROM.SYS") + " /D:CDDRVR", configSysFlags%) = 0 THEN
- configSysFlags% = kNoBackupFlag
- END IF
- END IF
-
- '** Add DOSClip to AutoExec.bat
-
- IF GetListItem(gCheckStates$, kInstallDOSClip) = "ON" THEN
- needTmp% = 1
- IF StripFileAndAdd(gAutoExec$, "DOSClip", "LH " + MakePath(gDest$, "DOSClip"), autoExecFlags%) = 0 THEN
- autoExecFlags% = kNoBackupFlag
- END IF
- END IF
-
- '** Create the temp directory and tmp environment variable
- '** if they're needed and they don't yet exist
-
- tmpDir$ = GetEnvVariableValue("tmp")
- IF (tmpDir$ = "") OR (DoesDirExist(tmpDir$)=0) THEN
-
- '** Figure out what tmp should be
-
- tmpDir$ = gSysDrive$ + ":\Temp"
-
- '** Add it to the environment
-
- IF StripFileAndAdd(gAutoExec$, "tmp=", "set tmp=" + tmpDir$, autoExecFlags%) = 0 THEN
- autoExecFlags% = kNoBackupFlag
- END IF
-
- '** Create the directory
-
- CreateDir tmpDir$, cmoVital
-
- END IF
-
- '** If there are system files that need to be updated,
- '** then restart the computer after informing the user.
-
- IF RestartListEmpty = 0 THEN
- IF ExitExecRestart = 1 THEN
- '** Hmmm. We failed!
- END IF
- END IF
-
- END SUB
-
-
-
- '**
- '** Purpose:
- '** Appends a file name to the end of a directory path,
- '** inserting a backslash character as needed.
- '** Arguments:
- '** szDir$ - full directory path (with optional ending "\")
- '** szFile$ - filename to append to directory
- '** Returns:
- '** Resulting fully qualified path name.
- '*************************************************************************
- FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
- IF szDir$ = "" THEN
- MakePath = szFile$
- ELSEIF szFile$ = "" THEN
- MakePath = szDir$
- ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
- MakePath = szDir$ + szFile$
- ELSE
- MakePath = szDir$ + "\" + szFile$
- END IF
- END FUNCTION
-